import { mapState, mapGetters, mapMutations, mapActions } from "vuex"

import Module from "./module"
import Page from "./page"
import Handles from "./handles"

export default {
	mixins: [Page, Module, Handles],
	data() {
		return {
			path: this.path,
			isApp: this.isApp,
			isMp: this.isMp,
			isH5: this.isH5,
		}
	},
	computed: {
		...mapState({
			userInfo: state => state.user.userInfo,
		}),
		...mapGetters({
			isLogin: "isLogin",
		}),
		showMessage() {
			return {
				success: (...argument) => {
					this.$refs.content?.showToastSuccess(...argument)
				},
				error: (...argument) => {
					this.$refs.content?.showToastError(...argument)
				},
				modal: (...argument) => {
					this.$refs.content?.showModal(...argument)
				},
			}
		},
	},
	methods: {
		...mapMutations({
			logout: "logout",
		}),
		...mapActions({
			reloadUserInfo: "reloadUserInfo",
		}),
	},
}
